/*
 * Copyright (C) 2025 David Picard
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

#pragma once

/**
 * @ingroup     drivers_max31865
 * @{
 *
 * @file
 * @brief       Default lookup table
 *
 * @author      David Picard
 */

#include "container.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifndef MAX31865_CUSTOM_LUT_PROVIDED

/** Number of lines in #max31865_lut */
#define MAX31865_LUT_NUMLINES        (ARRAY_SIZE(max31865_lut))
/**
 * @ingroup drivers_max31865
 * @brief Default lookup table for temperature conversion
 *
 * The columns of this table should be indexed by #max31865_lutcols_t.
 *
 * This lookup table was generated by @p genlut.py, provided with
 * the max31865 driver.
 *
 * Lookup table parameters:
 * - RTD @ 0°C = 100&Omega;
 * - RREF      = 330&Omega;
 * - Tmin      = -200°C
 * - Tmax      = 650°C
 */
static const int32_t max31865_lut[][4] =
{ { 0x0E5E, -200000000, -242967290, 11682 },
  { 0x11B6, -190000000, -243466981, 11792 },
  { 0x1506, -180000000, -244071429, 11905 },
  { 0x184E, -170000000, -244425837, 11962 },
  { 0x1B92, -160000000, -245036145, 12048 },
  { 0x1ED0, -150000000, -245496368, 12107 },
  { 0x220A, -140000000, -246268293, 12195 },
  { 0x253E, -130000000, -247125307, 12285 },
  { 0x286C, -120000000, -247438424, 12315 },
  { 0x2B98, -110000000, -248461538, 12407 },
  { 0x2EBE, -100000000, -248830846, 12438 },
  { 0x31E2, -90000000, -249625000, 12500 },
  { 0x3502, -80000000, -250477387, 12563 },
  { 0x381E, -70000000, -251388889, 12626 },
  { 0x3B36, -60000000, -251873418, 12658 },
  { 0x3E4C, -50000000, -252385787, 12690 },
  { 0x4160, -40000000, -253469388, 12755 },
  { 0x4470, -30000000, -254040921, 12788 },
  { 0x477E, -20000000, -254641026, 12821 },
  { 0x4A8A, -10000000, -255269923, 12853 },
  { 0x4D94, 0, -256589147, 12920 },
  { 0x509A, 10000000, -256589147, 12920 },
  { 0x53A0, 20000000, -258025974, 12987 },
  { 0x56A2, 30000000, -258776042, 13021 },
  { 0x59A2, 40000000, -259556136, 13055 },
  { 0x5CA0, 50000000, -260366492, 13089 },
  { 0x5F9C, 60000000, -262052632, 13158 },
  { 0x6294, 70000000, -262052632, 13158 },
  { 0x658C, 80000000, -263862434, 13228 },
  { 0x6880, 90000000, -264801061, 13263 },
  { 0x6B72, 100000000, -265771277, 13298 },
  { 0x6E62, 110000000, -266773333, 13333 },
  { 0x7150, 120000000, -267807487, 13369 },
  { 0x743C, 130000000, -269946237, 13441 },
  { 0x7724, 140000000, -269946237, 13441 },
  { 0x7A0C, 150000000, -272216216, 13514 },
  { 0x7CF0, 160000000, -273387534, 13550 },
  { 0x7FD2, 170000000, -274592391, 13587 },
  { 0x82B2, 180000000, -275831063, 13624 },
  { 0x8590, 190000000, -277103825, 13661 },
  { 0x886C, 200000000, -278410959, 13699 },
  { 0x8B46, 210000000, -281101928, 13774 },
  { 0x8E1C, 220000000, -282486188, 13812 },
  { 0x90F0, 230000000, -283905817, 13850 },
  { 0x93C2, 240000000, -285361111, 13889 },
  { 0x9692, 250000000, -286852368, 13928 },
  { 0x9960, 260000000, -288379888, 13966 },
  { 0x9C2C, 270000000, -291516854, 14045 },
  { 0x9EF4, 280000000, -291516854, 14045 },
  { 0xA1BC, 290000000, -294802260, 14124 },
  { 0xA480, 300000000, -296487252, 14164 },
  { 0xA742, 310000000, -298210227, 14205 },
  { 0xAA02, 320000000, -299971510, 14245 },
  { 0xACC0, 330000000, -301771429, 14286 },
  { 0xAF7C, 340000000, -305459770, 14368 },
  { 0xB234, 350000000, -307348703, 14409 },
  { 0xB4EA, 360000000, -307348703, 14409 },
  { 0xB7A0, 370000000, -311275362, 14493 },
  { 0xBA52, 380000000, -313284884, 14535 },
  { 0xBD02, 390000000, -317397661, 14620 },
  { 0xBFAE, 400000000, -317397661, 14620 },
  { 0xC25A, 410000000, -319530792, 14663 },
  { 0xC504, 420000000, -323893805, 14749 },
  { 0xC7AA, 430000000, -326124260, 14793 },
  { 0xCA4E, 440000000, -328397626, 14837 },
  { 0xCCF0, 450000000, -330714286, 14881 },
  { 0xCF90, 460000000, -333074627, 14925 },
  { 0xD22E, 470000000, -337897898, 15015 },
  { 0xD4C8, 480000000, -337897898, 15015 },
  { 0xD762, 490000000, -342900302, 15106 },
  { 0xD9F8, 500000000, -345454545, 15152 },
  { 0xDC8C, 510000000, -348054711, 15198 },
  { 0xDF1E, 520000000, -350701220, 15244 },
  { 0xE1AE, 530000000, -353394495, 15291 },
  { 0xE43C, 540000000, -356134969, 15337 },
  { 0xE6C8, 550000000, -361728395, 15432 },
  { 0xE950, 560000000, -364582043, 15480 },
  { 0xEBD6, 570000000, -367484472, 15528 },
  { 0xEE5A, 580000000, -370436137, 15576 },
  { 0xF0DC, 590000000, -373437500, 15625 },
  { 0xF35C, 600000000, -376489028, 15674 },
  { 0xF5DA, 610000000, -382712934, 15773 },
  { 0xF854, 620000000, -382712934, 15773 },
  { 0xFACE, 630000000, -389142857, 15873 },
  { 0xFD44, 640000000, -392420382, 15924 },
  { 0xFFB8, 650000000, -395750799, 15974 } };

#endif  /* MAX31865_CUSTOM_LUT_PROVIDED */

#ifdef __cplusplus
}
#endif

/** @} */
